home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / shell / shell.swf / scripts / frame_2 / DoAction.as < prev   
Encoding:
Text File  |  2004-07-06  |  6.7 KB  |  230 lines

  1. function interrupt()
  2. {
  3.    if(intro != null)
  4.    {
  5.       intro._visible = false;
  6.    }
  7.    if(mc_credits != null)
  8.    {
  9.       mc_credits.interrupt();
  10.    }
  11. }
  12. function resume()
  13. {
  14.    if(intro != null)
  15.    {
  16.       intro._visible = true;
  17.       var obj = OverlayController.getLastOverlay();
  18.       OverlayController.resumeOverlay(obj);
  19.    }
  20.    if(mc_credits != null)
  21.    {
  22.       mc_credits.resume();
  23.    }
  24. }
  25. function exit()
  26. {
  27.    if(blnInExit == true)
  28.    {
  29.       return undefined;
  30.    }
  31.    lingo("spriteDialog.show(\"exit\")");
  32.    blnInExit = true;
  33. }
  34. function creditsShow()
  35. {
  36.    Tardis.TardisInterface.disable(true);
  37.    header.clearUp();
  38.    footer.disable();
  39.    this.createEmptyMovieClip("mc_credits",Tardis.depth++);
  40.    mc_credits.loadMovie(ENGINE_FOLDER + "swf/credits.swf");
  41.    gotoAndStop(18);
  42. }
  43. function creditsComplete()
  44. {
  45.    lingo("");
  46.    lingo("Flsh_exit");
  47. }
  48. function init()
  49. {
  50.    Settings = {};
  51.    xmlIssueData = new XML();
  52.    xmlIssueData.onLoad = function()
  53.    {
  54.       parseIssueXML();
  55.       delete parseIssueXML;
  56.       delete xmlIssueData;
  57.       UsageData.LOG_URL = Settings.tracking.log_url;
  58.       UsageData.PING_URL = Settings.tracking.ping_url;
  59.       with(UsageData)
  60.       {
  61.          init();
  62.          addPingEntry();
  63.          addSessionGroup();
  64.       }
  65.       delete UsageData.init;
  66.       ConnCheck.onTestComplete = function(success)
  67.       {
  68.          Tardis.debug.addProcess("monitorTracking","ConnCheck.onTestComplete(success) : success = " + success);
  69.          if(success)
  70.          {
  71.             with(Tardis.UsageData)
  72.             {
  73.                if(!active)
  74.                {
  75.                   checkSend();
  76.                }
  77.             }
  78.          }
  79.          else
  80.          {
  81.             Tardis.UsageData.dbg("no connection");
  82.          }
  83.       };
  84.       ConnCheck.TIMER_INTERVAL = Settings.tracking.interval;
  85.       ConnCheck.startTimer();
  86.       if(PLAY_MODE == "director")
  87.       {
  88.          gotoAndStop(6);
  89.       }
  90.       else
  91.       {
  92.          gotoAndStop(12);
  93.          footer.show();
  94.          header.clearUp();
  95.       }
  96.       delete Settings.tracking;
  97.       delete init;
  98.    };
  99.    xmlIssueData.load(ISSUE_XMLFILE);
  100. }
  101. function parseIssueXML()
  102. {
  103.    var ndRoot = xmlIssueData.firstChild;
  104.    var ndSponsor = ndRoot.byName("sponsor");
  105.    var ndTracking = ndRoot.byName("tracking");
  106.    var ndIntro = ndRoot.byName("intro");
  107.    var ndDate = ndRoot.byName("date");
  108.    ASSETS_FOLDER = ndRoot.byName("assets").getText();
  109.    ENGINE_FOLDER = ndRoot.byName("engine").getText();
  110.    lingo("spriteShell.setAssetsPath(\"" + ASSETS_FOLDER + "\")");
  111.    Sections = new SectionsList(ndRoot.byName("sections"));
  112.    delete SectionsList;
  113.    Colors = new ColorsObject(ndRoot.byName("colors"));
  114.    delete ColorsObject;
  115.    Settings = {issue_month:ndDate.attributes.month,issueMonth:ndDate.attributes.month,issue_year:ndDate.attributes.year,issueYear:ndDate.attributes.year,version:ndRoot.byName("version").getText(),FEATURE_ASSETS:ASSETS_FOLDER + "bespoke/feature"};
  116.    Settings.tracking = {log_url:ndTracking.byName("log_url").getText(),ping_url:ndTracking.byName("ping_url").getText(),interval:ndTracking.byName("interval").getText()};
  117.    setupIntro = function()
  118.    {
  119.       Settings.intro = {};
  120.       Settings.sponsor = {};
  121.       Settings.sponsor.files = new Array();
  122.       tmpNode = ndIntro.firstChild;
  123.       i = 1;
  124.       while(tmpNode != null)
  125.       {
  126.          Settings.intro["ndPanel" + i] = tmpNode;
  127.          tmpNode = tmpNode.nextSibling;
  128.          i++;
  129.       }
  130.       var SponsorXML = new XML();
  131.       SponsorXML.parseXML("<sponsor><panel id=\'3\' category=\'swf\' button=\'skipAdvert\' disableLevel=\'2\' header=\'default\'>adverts/overlays/aol/base_button.swf</panel></sponsor>");
  132.       Settings.sponsor.files[0] = SponsorXML.firstChild.firstChild;
  133.       Settings.intro.numberOfPanels = i - 1;
  134.       delete tmpNode;
  135.       delete i;
  136.    };
  137.    setupIntro();
  138.    xmlPromosData = new XML();
  139.    xmlPromosData.ignoreWhite = true;
  140.    xmlPromosData.onLoad = function(success)
  141.    {
  142.       if(success)
  143.       {
  144.          var numPromos = this.firstChild.childNodes.length;
  145.          if(numPromos > 0)
  146.          {
  147.             Settings.promos = {};
  148.             var sectionNode = this.firstChild.firstChild;
  149.             while(sectionNode != null)
  150.             {
  151.                var o = {};
  152.                var node = sectionNode.firstChild;
  153.                while(node != null)
  154.                {
  155.                   var promoNode = node.firstChild;
  156.                   while(promoNode != null)
  157.                   {
  158.                      if(!Settings.promos[node.parentNode.attributes.id])
  159.                      {
  160.                         Settings.promos[node.parentNode.attributes.id] = {};
  161.                      }
  162.                      if(!Settings.promos[node.parentNode.attributes.id][promoNode.parentNode.attributes.id])
  163.                      {
  164.                         Settings.promos[node.parentNode.attributes.id][promoNode.parentNode.attributes.id] = {};
  165.                      }
  166.                      Settings.promos[node.parentNode.attributes.id][node.attributes.id][promoNode.nodeName] = promoNode.firstChild.nodeValue;
  167.                      promoNode = promoNode.nextSibling;
  168.                   }
  169.                   node = node.nextSibling;
  170.                }
  171.                sectionNode = sectionNode.nextSibling;
  172.             }
  173.             for(var o in Settings.promos)
  174.             {
  175.                for(var p in Settings.promos[o])
  176.                {
  177.                   for(var h in Settings.promos[o][p])
  178.                   {
  179.                   }
  180.                }
  181.             }
  182.          }
  183.          else
  184.          {
  185.             trace("! There are no promos to promo  - that makes me sad :(");
  186.          }
  187.       }
  188.    };
  189.    xmlPromosData.load(ASSETS_FOLDER + PROMOS_XMLFILE);
  190. }
  191. _global.error = function(str)
  192. {
  193.    trace("error : " + str);
  194. };
  195. blnInExit = false;
  196. connTardisReceive = new LocalConnection();
  197. connTardisReceive.exit_cancel = function()
  198. {
  199.    Tardis.blnInExit = false;
  200.    Tardis.footer.buttonReset("exit");
  201.    Tardis.resume();
  202. };
  203. connTardisReceive.UsageData_markExit = function()
  204. {
  205.    Tardis.UsageData.addPageEntry(99);
  206.    Tardis.UsageData.checkSend();
  207.    Tardis.overlay.active = false;
  208. };
  209. connTardisReceive.ConnCheck_stopTimer = function()
  210. {
  211.    Tardis.ConnCheck.stopTimer();
  212. };
  213. connTardisReceive.childlock_lock = function()
  214. {
  215.    Tardis.ChildLock.lock();
  216. };
  217. connTardisReceive.childlock_unlock = function()
  218. {
  219.    Tardis.ChildLock.unlock();
  220. };
  221. connTardisReceive.intro_nextState = function()
  222. {
  223.    Tardis.intro.nextState();
  224. };
  225. connTardisReceive.UsageData_setValue = function(strSoObject, strProp, val)
  226. {
  227.    Tardis.UsageData.setSoProp(strSoObject,strProp,val);
  228. };
  229. success = connTardisReceive.connect("Tardis");
  230.